//
//  MPCActionSheet.h
//  MPCActionSheet
//
//  Created by macRong on 08/28/2017.
//  Copyright (c) 2017 jxzjxz. All rights reserved.
//


#import <UIKit/UIKit.h>
#import "MPCActionSheetConfig.h"
@class MPCActionSheet;


NS_ASSUME_NONNULL_BEGIN

@protocol MPCActionSheetDelegate <NSObject>

@optional

/**
 Handle click button.
 */
- (void)actionSheet:(MPCActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex;

/**
 Handle action sheet will present.
 */
- (void)willPresentActionSheet:(MPCActionSheet *)actionSheet;
/**
 Handle action sheet did present.
 */
- (void)didPresentActionSheet:(MPCActionSheet *)actionSheet;

/**
 Handle action sheet will dismiss.
 */
- (void)actionSheet:(MPCActionSheet *)actionSheet willDismissWithButtonIndex:(NSInteger)buttonIndex;
/**
 Handle action sheet did dismiss.
 */
- (void)actionSheet:(MPCActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex;


@end


@interface MPCActionSheet : UIView


@property (nonatomic, strong) NSArray<NSString *> *otherButtonTitles;
@property (nonatomic, strong) NSArray<NSString *> *images;
@property (nonatomic, assign) CGSize titleTextSize;
@property (nonatomic, weak) UIView *bottomView;
@property (nonatomic, weak) UIVisualEffectView *blurEffectView;
@property (nonatomic, weak) UIView *darkView;
@property (nonatomic, weak) UILabel *titleLabel;
@property (nonatomic, weak) UITableView *tableView;
@property (nonatomic, weak) UIView *divisionView;
@property (nonatomic, weak) UIButton *cancelButton;
@property (nonatomic, weak) UIView *whiteBgView;
@property (nonatomic, weak) UIView *lineView;
@property (nullable, nonatomic, strong) UIWindow *window;

// 自定义config
@property (nonatomic, strong) MPCActionSheetConfig *customConfig;

/**
 Initialize an instance of MPCActionSheet (秒拍组件库C1).
 
 @param title             title
 @param delegate          delegate
 @param cancelButtonTitle cancelButtonTitle
 @param otherButtonTitles otherButtonTitles
 
 @return An instance of MPCActionSheet.
 */
+ (instancetype)sheetWithTitle:(nullable NSString *)title
                      delegate:(nullable id<MPCActionSheetDelegate>)delegate
             cancelButtonTitle:(nullable NSString *)cancelButtonTitle
             otherButtonTitles:(nullable NSString *)otherButtonTitles, ... NS_REQUIRES_NIL_TERMINATION;

/**
 Initialize an instance of MPCActionSheet (秒拍组件库C2-左图右文).
 
 @param images             left Images
 @param otherButtonTitles otherButtonTitles
 @param delegate          delegate
 
 @return An instance of MPCActionSheet.
 */
+ (instancetype)sheetWithImages:(nullable NSArray <NSString *> *)images
              otherButtonTitles:(nullable NSArray <NSString *> *)otherButtonTitles
                       delegate:(nullable id<MPCActionSheetDelegate>)delegate;


/**
 自定义上部view

 @param customView cview
 @param cancelButtonTitle 取消按钮
 @param delegate delegate
 @param otherButtonTitles 其他btn
 @return self
 */
+ (instancetype)sheetWithCustomView:(nullable UIView *)customView
                      customsConfig:(MPCActionSheetConfig *)config
                  cancelButtonTitle:(nullable NSString *)cancelButtonTitle
                       delegate:(nullable id<MPCActionSheetDelegate>)delegate
                  otherButtonTitles:(nullable NSString *)otherButtonTitles, ... NS_REQUIRES_NIL_TERMINATION;

/**
 Show the instance of MPCActionSheet.
 */
- (void)show;


@end

NS_ASSUME_NONNULL_END


/** Example:
 
 MPCActionSheet *actionSheet = [MPCActionSheet sheetWithTitle:nil
 delegate:self
 cancelButtonTitle:@"Cancel"
 otherButtonTitles:@"Button 1", @"Button 2", @"Button 3", nil];
 [actionSheet show];
 
 */

